import Vue from 'vue'
import VueRouter from 'vue-router'

const home = () => import ('@/views/home.vue')
const personalized = () => import ('@/views/Discovermusic/Personalized.vue')
const exclusive = () => import ('@/views/Discovermusic/exclusive.vue')
const persona = () => import ('@/views/Discovermusic/persona.vue')
const RankingList = () => import ('@/views/Discovermusic/RankingList.vue')


const singer = () => import ('@/views/Discovermusic/singer.vue')
const songsheet = () => import ('@/views/Discovermusic/songsheet.vue')
const newmusic = () => import ('@/views/Discovermusic/newmusic.vue')
const distoplist = () => import ('@/views/Discovermusic/distoplist.vue')

const songlistdata = () => import ('@/views/songlistdata.vue')
//songlist
const songlist = () => import ('@/views/songlist/songlist.vue')
// const songcopy = () => import ('@/views/songlist/songlistcopy.vue')

const comment = () => import ('@/views/songlist/comment.vue')
const collection = () => import ('@/views/songlist/collection.vue')


//user
const user = () => import ('@/views/user/user.vue')

//search
const search = () => import ('@/views/search/search.vue')





// const top = () => import ('@/components/top.vue')


Vue.use(VueRouter)

const routes = [
    {
        path: '/home',
        component: home,
        children:[
            {
                path:'/home/personalized',
                component:personalized,
                children:[{
                        path:'/home/personalized/persona',
                        component:persona
                    },
                    
                    {
                        path:'/home/personalized/exclusive',
                        component:exclusive
                    },
                    {
                        path:'/home/personalized/singer',
                        component:singer
                    },
                    {
                        path:'/home/personalized/RankingList',
                        component:RankingList
                    },
                    {
                        path:'/home/personalized/songsheet',
                        component:songsheet
                    },
                    {
                        path:'/home/personalized/newmusic',
                        component:newmusic
                    },
                    {
                        path:'/home/personalized/distoplist',
                        component:distoplist
                    },
                    {
                        path:'/home/personalized',
                        redirect: '/home/personalized/persona'
                    }
                ]
            },
            {
                name:'user',
                path:'/home/user/:id',
                component:user
            },
            {
                name:'search',
                path:'/home/search/:name',
                component:search
            },
            {
                name:'songlistid',
                path:'/home/songlistdata/:id',
                component:songlistdata,
                redirect:'/home/songlistdata/:id/songlist',
                children:[{
                    name:'songlistname',
                    path:'/home/songlistdata/:id/songlist',
                    component:songlist
                },{
                    name:'commentname',
                    path:'/home/songlistdata/:id/comment',
                    component:comment
                },{
                    name:'collectionname',
                    path:'/home/songlistdata/:id/collection',
                    component:collection
                },
                
 
            ]
            
            },            
            {
                //重定向(优先级最低)
                path: '/home',
                redirect: '/home/personalized'
            }
        ]
    },
    {
        path: '*',
        redirect:'/home'
    }
]

const router = new VueRouter({
    // mode: 'history',
    // base: /home/,
    routes
})

export default router